Fix MessageListView rotation crash and custom messagesStart not being applied#6438
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesMessage List Layout Initialization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🚀 Available in v6.38.0 |
* Fix MessageListView rotation crash and custom messagesStart not being applied (#6438) * Add configurable character limits and feature toggles for polls (#6435) * Add configurable character limits and feature toggles for polls Introduces PollsConfig to control poll feature availability and enforce character limits on questions and options. Poll features (multiple votes, anonymous voting, suggest options, add comments) can now be hidden or preset with default values through ChatUI.pollsConfig or passed directly to CreatePollDialogFragment. * addressing pr comments * 1. Detekt - Fixed the MaxLineLength violation in PollsConfig.kt:23 by breaking the long comment line 2. Spotless - Applied formatting fixes (added license header to PollFeatureConfig.kt) 3. API Check - Regenerated the API dump file * Update stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/attachment/picker/poll/PollsConfig.kt Co-authored-by: Gianmarco <47775302+gpunto@users.noreply.github.com> * Apply suggestion from @gpunto --------- Co-authored-by: Gianmarco <47775302+gpunto@users.noreply.github.com> * Allow voters to suggest poll options in UI Components (#6439) * Allow voters to suggest poll options in UI Components * Use doAfterTextChanged * Align Compose & XML option name trimming * Apply optionTextLimit to suggest poll option dialog (#6446) * Allow voters to add poll comments in UI Components (#6444) * Allow voters to add poll comments in UI Components * Add missing KDoc and default params * Adjust poll comments commit to develop's APIs - Use UiCommonR for stream_ui_poll_action_view_comments plural - Update StateRegistry imports to client.api.state package * Reformat * Add default value to pollSuggestOptionTextStyle * Init poll suggest option confirm button state from current input * Validate poll text limits at PollsConfig construction * Make SuggestPollOptionDialogFragment internal for consistency * Reapply poll feature visibility on rotation in CreatePollDialogFragment * Add MessageListViewModel test for suggesting a poll option * Add CreatePollViewModel test for config propagation --------- Co-authored-by: Ryan Hurst <106116154+ryanhurststrava@users.noreply.github.com>



Goal
Fix a
MessageListViewcrash on configuration change (e.g. rotation) when the activity restores its state into a list that gets submitted before the layout pipeline has settled:The race was reliably reproducible in the sample app with
app:streamUiMessagesStart="top": open a channel, open the create-poll dialog, fill title/options, then rotate.While debugging, also fixed a second bug: setting
messagesStartviaTransformStyle.messageListStyleTransformer(the customer-facing API) didn't actually apply.Implementation
chatMessagesRV's height betweenMATCH_PARENTandWRAP_CONTENTbased onMessagesStart. Both modes now use the inflatedMATCH_PARENT × MATCH_PARENT. The TOP vs BOTTOM anchoring is expressed viaLinearLayoutManager.stackFromEndinstead, which gives the same visual result without re-measuring the RV on everyonBindViewHolder. The repeated re-measure cascade was what produced the animator/recycler race.chatMessageStartafterinitRecyclerViewininit, so the layout manager exists when the style is applied. Previously the layout manager was null at that point, the newstackFromEnd-based path returned early, and the configuredmessagesStartwas effectively ignored on first render.Testing
Verified all four
messagesStart/threadMessagesStartcombinations viaTransformStyle.messageListStyleTransformerin the sample app:BOTTOM/BOTTOM: main and threads anchored to bottom.TOP/TOP: main and threads anchored to top.TOP/BOTTOMandBOTTOM/TOP: mixed anchors render correctly per surface.For each combination:
Summary by CodeRabbit
Bug Fixes
Refactor